#include "externSo.h"
#include <string>
#include "stdio.h"
#include "manager.h"
#include "timer.h"

int sendToBack(const char *buf, int size, void* mv){
	manager* m = (manager *)mv;
	if( m == NULL ){
		return -1;
	}
	return m->sendToBack(buf, size);
}

int sendToFront(const char *buf, int size, void* mv){
	manager* m = (manager *)mv;
	if( m == NULL ){
		return -1;
	}
	return m->sendToFront(buf, size);
}

int setBackIpPort(const char* ip, int port, void* mv){
	manager* m = (manager *)mv;
	if( m == NULL ){
		return -1;
	}
	return m->setBackIpPort(ip, port);
}

int startTimer(int id, int time, int utime = 0){

	timer *t = new timer(id);
	if( t == NULL ){
		return -1;
	}
	t->startTimer(time, utime);
	g_TimerMap[id] = t;
	return 0;
}

int stopTimer(int id ){

	if( g_TimerMap.find(id) == g_TimerMap.end() ){
		return -1;
	}
	g_TimerMap[id]->stopTimer();
	return 0;
}

